package com.ohuang.wallpapermanager.screen

import androidx.compose.runtime.Composable
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavType
import androidx.navigation.compose.composable
import androidx.navigation.navArgument

object Destination {

    const val HOME = "home"
    const val SETTINGS = "settings"



    fun NavGraphBuilder.SettingWallPaper(content: @Composable (isLock: Boolean?) -> Unit) {
        composable(
            route = "settingWallPaper/{isLock}",
            arguments = listOf(
                navArgument("isLock") {
                    type = NavType.BoolType //设置类型 不设置默认String
                }),
        ) {
            val isLock = it.arguments?.getBoolean("isLock")
            content(isLock)
        }
    }

    fun settingWallPaper(isLock: Boolean): String {
        return "settingWallPaper/$isLock"
    }


    fun NavGraphBuilder.WallPaperList(content: @Composable (isLock: Boolean?) -> Unit) {
        composable(
            route = "WallPaperList/{isLock}",
            arguments = listOf(
                navArgument("isLock") {
                    type = NavType.BoolType //设置类型 不设置默认String
                }),
        ) {
            val isLock = it.arguments?.getBoolean("isLock")
            content(isLock)
        }
    }

    fun wallPaperList(isLock: Boolean): String {
        return "WallPaperList/$isLock"
    }


    fun NavGraphBuilder.EditWallPaperInfo(content: @Composable (isLock: Boolean?,id:Long?) -> Unit) {
        composable(
            route = "EditWallPaperInfo/{isLock}/{id}",
            arguments = listOf(
                navArgument("isLock") {
                    type = NavType.BoolType //设置类型 不设置默认String
                } ,
                navArgument("id") {
                    type = NavType.LongType //设置类型 不设置默认String
                }),
        ) {
            val isLock = it.arguments?.getBoolean("isLock")
            val id = it.arguments?.getLong("id")
            content(isLock,id)
        }
    }

    fun editWallPaperInfo(isLock: Boolean,id:Long=0): String {
        return "EditWallPaperInfo/$isLock/$id"
    }

}